/**
 * Class: Event
 *
 * Purpose: 
 *
 * Created: Jan 30, 2010 @ 3:27:56 PM
 * @author Ken Scott
 */
package org.openfantasia.musica.events;

import org.openfantasia.musica.Musica;

public class Event implements Comparable<Event> {

	public static final String DEFAULT_NAME = "Unnamed";

	public static final long INVALID_TIME = Long.MIN_VALUE;

	public static final int INVALID_DURATION = Integer.MIN_VALUE;

	protected Musica musica;

	protected String name = DEFAULT_NAME;

	protected long time = INVALID_TIME;

	protected int duration = INVALID_DURATION;


	protected Event() {
	}


	public Event(Musica mc) {
		this.musica = mc;
	}


	public Event(Musica mc, int duration) {
		this(mc);
		this.duration = duration;
	}


	public Event(Event that) {
		copy(that);
	}


	public Event copy() {
		return new Event(this);
	}


	public void copy(Event that) {
		this.musica = that.musica;
		this.name = that.name;
		this.time = that.time;
		this.duration = that.duration;
	}


	public Musica getMusica() {
		return musica;
	}


	public long getTime() {
		return time;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public void setTime(long time) {
		this.time = time;
	}


	public int getDuration() {
		return duration;
	}


	public void setDuration(int duration) {
		this.duration = duration;
	}


	public int compareTo(Event event) {
		return ((Long) time).compareTo(event.getTime());
	}


	public void transpose(Event event, int amount) {
		// Nothing to do here
	}


	public Event transpose(int amount) {
		Event result = copy();
		transpose(result, amount);
		return result;
	}


	public void action() {
	}
}
